from apps.UploadFile.models import *

class DeleteMessageClass:
    def __init__(self,obj,mes_type):
        """

        :param obj: 传入request对象
        :param mes_type: 要删除的数据类型 text img music video
        """
        self.obj = obj
        self.mes_type = mes_type


    def delete_message(self):
        id = self.obj.POST.get('delete_id')
        print(f"id:{id}")
        if self.mes_type == "text":
            Text_uploadModel.objects.filter(id=id).delete()
        elif self.mes_type == "img":
            Imgs_uploadModel.objects.filter(id=id).delete()
        return id